(self.AMP=self.AMP||[]).push({m:0,v:"2110011758000",n:"amp-lightbox",ev:"0.1",l:true,f:function(AMP,_){"use strict";var f;function aa(a){var b=0;return function(){return bb&&(b=10);var c=Date.now()+b;return!this.isPending()||-10>c-this.fa?(this.cancel(),this.fa=c,this.S=this.Aa.delay(this.Ca,b),!0):!1};L.prototype.ba=function(){this.S=-1;this.fa=0;this.la=!0;this.Ha();this.la=!1};L.prototype.cancel=function(){this.isPending()&&(this.Aa.cancel(this.S),this.S=-1)};function Fa(a,b,c,d){this.type=a;this.data=b;this.time=c;this.event=d}function Ga(a,b,c){this.F=a;this.h=[];this.N=[];this.B=[];this.j=[];this.o=null;this.Oa=b;this.Pa=c;this.ca=!1;this.ba=new L(a.ownerDocument.defaultView,this.va.bind(this));this.xa=new x;this.R=Object.create(null);this.ta=this.Na.bind(this);this.ra=this.La.bind(this);this.sa=this.Ma.bind(this);this.qa=this.Ka.bind(this);var d=ja(a.ownerDocument.defaultView);this.F.addEventListener("touchstart",this.ta,d?{passive:!0}:!1);this.F.addEventListener("touchend",this.ra);this.F.addEventListener("touchmove",this.sa,d?{passive:!0}:!1);this.F.addEventListener("touchcancel",this.qa);this.ha=!1}function Ha(a){var b=void 0===b?!1:b;var c=void 0===c?!1:c;var d=a.__AMP_Gestures;d||(d=new Ga(a,b,c),a.__AMP_Gestures=d);return d}f=Ga.prototype;f.cleanup=function(){this.F.removeEventListener("touchstart",this.ta);this.F.removeEventListener("touchend",this.ra);this.F.removeEventListener("touchmove",this.sa);this.F.removeEventListener("touchcancel",this.qa);delete this.F.__AMP_Gestures;this.ba.cancel()};f.onGesture=function(a,b){var c=new a(this),d=c.getType(),e=this.R[d];e||(this.h.push(c),e=new x,this.R[d]=e);return e.add(b)};f.removeGesture=function(a){var b=new a(this).getType();if(a=this.R[b]){a.removeAll();a=ha(this.h,(function(c){return c.getType()==b}));if(0>a)return!1;this.h.splice(a,1);this.B.splice(a,1);this.j.splice(a,1);this.N.splice(a,1);delete this.R[b];return!0}return!1};f.onPointerDown=function(a){return this.xa.add(a)};f.Na=function(a){var b=Date.now();this.ca=!1;this.xa.fire(a);for(var c=0;c=d){c=!0;break}c?(b.stopPropagation(),a.Oa||b.preventDefault()):a.Pa&&b.stopPropagation();a.ha&&(a.ha=!1,a.va())}f.va=function(){for(var a=Date.now(),b=-1,c=0;cthis.B[b])b=c;if(-1!=b){var d=0;for(c=0;cd){a=b;c=this.h[a];for(var e=0;eb&&(b=1);var d=.5+Math.min(b/33.34,.5);return a/b*d+c*(1-d)}function P(a,b,c,d){O.call(this,a,b);this.wa=c;this.Ba=d;this.o=!1;this.pa=this.oa=this.ia=this.$=this.za=this.ka=this.ja=this.K=this.J=this.M=this.L=0}t(P,O);f=P.prototype;f.onTouchStart=function(a){a=a.touches;return this.o&&a&&1b)this.signalReady(-10);else if(8<=b)return!1}else if(this.Ba){if(8<=b&&b>a)this.signalReady(-10);else if(8<=a)return!1}else return!1;return!0}return!1};f.onTouchEnd=function(a){var b=a.touches;b&&0==b.length&&this.o&&(this.o=!1,Q(this,!1,!0,a),this.signalEnd())};f.acceptStart=function(){this.o=!0;this.ja=this.L;this.ka=this.M;this.ia=this.za;this.L=this.J;this.M=this.K;Q(this,!0,!1,null)};f.acceptCancel=function(){this.o=!1};function Q(a,b,c,d){a.$=Date.now();var e=a.$-a.ia;if(!c&&4
Ad
'],X={"fade-in":{openStyle:w({opacity:1}),closedStyle:w({opacity:0}),durationSeconds:.1},"fly-in-bottom":{openStyle:w({transform:"translate(0, 0)"}),closedStyle:w({transform:"translate(0, 100%)"}),durationSeconds:.2},"fly-in-top":{openStyle:w({transform:"translate(0, 0)"}),closedStyle:w({transform:"translate(0, -100%)"}),durationSeconds:.2}};function Y(a){var b=AMP.BaseElement.call(this,a)||this;b.na=null;b.C=null;b.P=b.win.document;b.T=null;b.ea=-1;b.U=!1;b.X=null;b.W=null;b.Z=null;b.Y=null;b.ga=null;b.I=!1;b.G=0;b.da=0;b.ma=null;b.V=(a.getAttribute("animate-in")||"fade-in").toLowerCase();b.A=null;b.H=null;b.O=null;var c=G(b.win,"platform");b.Ia=c.isIos();b.ua=oa(b.win,(function(){var d=xa().assertElement(b.C,"E#19457 this.container_"),e=K(b.element);e.scheduleLayout(b.element,d);e.scheduleResume(b.element,d)}));return b}t(Y,AMP.BaseElement);f=Y.prototype;f.buildCallback=function(){var a=this;this.user().assert(ia.call(X,this.V),"Invalid `animate-in` value %s",this.V);this.element.classList.add("i-amphtml-overlay");this.T=Da(this.element);Va(this);this.registerDefaultAction((function(b){return Wa(a,b.trust,b.caller)}),"open");this.registerAction("close",(function(b){return a.close(b.trust)}));this.T.addToAllowlist("AMP-LIGHTBOX",["open","close"],["email"])};function Xa(a){v(a.element.getElementsByClassName("i-amphtml-element")).forEach((function(b){K(a.element).setOwner(b,a.element)}))}function Ya(a){if(!a.C){var b=a.element;a.I=b.hasAttribute("scrollable");var c=Ba(a.element);a.C=b.ownerDocument.createElement("div");a.I||a.C.classList.add("i-amphtml-fill-content");b.appendChild(a.C);c.forEach((function(d){a.C.appendChild(d)}));a.I&&(Xa(a),b.classList.add("i-amphtml-scrollable"),b.addEventListener("amp:dom-update",(function(){Xa(a);Z(a,a.G)})),b.addEventListener("scroll",a.ya.bind(a)));if(!a.I)Ha(b).onGesture(Ja,(function(){}));Za(a)}}f.layoutCallback=function(){u||(u=Promise.resolve(void 0));var a=u;return a};function Wa(a,b,c){if(!a.U){Ya(a);a.X=a.Fa.bind(a);a.P.documentElement.addEventListener("keydown",a.X);a.Z=a.Ja.bind(a);a.P.documentElement.addEventListener("focusin",a.Z);c&&(a.ga=c);var d=new ea,e=d.promise,g=d.resolve;a.getViewport().enterLightboxMode(a.element,e).then((function(){return $a(a,g,b)}))}}f.mutatedAttributesCallback=function(a){var b=a.open;void 0!==b&&(b?Wa(this,2,document.activeElement):this.close(2))};function ab(a){var b=a.C.querySelector("[autofocus]");b&&F(b)}function $a(a,b,c){function d(){a.ua();b()}var e=a.element,g=X[a.V],h=g.closedStyle,l=g.durationSeconds,k=g.openStyle,C=Object.keys(k).map((function(V){return V+" "+l+"s ease-in"})).join(",");a.da++;a.I&&S(e,"webkitOverflowScrolling","touch");S(e,"transition",C);T(e,U(h));Oa(e);a.mutateElement((function(){e.scrollTop=0}));ab(a);a.mutateElement((function(){T(e,U(k))}));g=a.C;a.I&&(a.ya(),Z(a,a.G));e.addEventListener("transitionend",d);e.addEventListener("animationend",d);a.setAsContainer();var va=K(a.element);va.scheduleLayout(a.element,g);va.scheduleResume(a.element,g);bb(a,"lightboxOpen",c);I(a.getAmpDoc(),"history").push((function(){return a.close(c)})).then((function(V){a.ea=V}));cb(a);db(a);eb(a);a.U=!0}function Za(a){var b=a.element;if(null!=b.getAttribute("close-button")){var c=b.ownerDocument||b;W&&W.ownerDocument===c||(W=c.createElement("div"));c=W;c.innerHTML=Ua[0];var d=c.firstElementChild;c.removeChild(d);a.A=d;b.insertBefore(a.A,a.C)}}function cb(a){if(a.A){a.W=a.Ea.bind(a);a.A.addEventListener("keydown",a.W);var b;a.measureMutateElement((function(){b=a.A.getBoundingClientRect().height}),(function(){a.A.classList.add("amp-ad-close-header");Na(a.C,{"margin-top":b+"px","min-height":"calc(100vh - "+b+"px)"})}))}}function eb(a){if(a.O||a.A)a.Y=a.Da.bind(a),a.H.addEventListener("click",a.Y)}function fb(a){if(a.O||a.A)a.H.removeEventListener("click",a.Y),a.Y=null,a.A&&(a.A.removeEventListener("keydown",a.W),a.W=null)}f.Da=function(){this.close(3)};f.Fa=function(a){"Escape"==a.key&&(a.preventDefault(),this.close(3))};f.Ea=function(a){"Enter"==a.key&&(a.preventDefault(),this.close(3))};f.close=function(a){var b=this;this.U&&(this.I&&S(this.element,"webkitOverflowScrolling",""),this.getViewport().leaveLightboxMode(this.element).then((function(){return gb(b,a)})))};function gb(a,b){function c(){e==a.da&&(a.collapse(),a.ua())}var d=a.element,e=++a.da;hb(a)?(Pa(d),c()):(d.addEventListener("transitionend",c),d.addEventListener("animationend",c));T(d,U(X[a.V].closedStyle));-1!=a.ea&&I(a.getAmpDoc(),"history").pop(a.ea);a.P.documentElement.removeEventListener("keydown",a.X);a.X=null;a.P.documentElement.removeEventListener("focusin",a.Z);a.Z=null;fb(a);a.removeAsContainer();Sa(a.element);K(a.element).schedulePause(a.element,a.C);a.U=!1;bb(a,"lightboxClose",b);a.ga&&F(a.ga)}function hb(a){return"inabox"==ua(a.win).runtime||Qa(a.element)}f.Ja=function(){this.element.contains(document.activeElement)||this.close(3)};function db(a){if(!a.element.contains(document.activeElement)){a:if(a.H)var b=a.H;else if(a.A)b=a.A;else{b=a.element;for(var c=b.querySelectorAll("[on]"),d=0;dMath.abs(b-a.G)){E().fine("amp-lightbox","slow scrolling: %s - %s",b,a.G);a.ma=null;var c=a.G;E().fine("amp-lightbox","update_");Z(a,c);a.G=c}else E().fine("amp-lightbox","fast scrolling: %s - %s",b,a.G),ib(a,a.G)}),100)}function Z(a,b){var c=[];jb(a,b,(function(d){c.push(d);K(a.element).scheduleLayout(a.element,d)}))}function jb(a,b,c){a.na||(a.na={width:a.element.clientWidth,height:a.element.clientHeight});for(var d=a.na.height,e=v(a.element.getElementsByClassName("i-amphtml-element")),g=0;g=b-C&&l<=b+C&&c(h)}}function Va(a){var b=a.win;Qa(a.element)&&kb(b,b.document.body)}function bb(a,b,c){var d=a.win;var e="amp-lightbox."+b;var g=w({}),h={detail:g};Object.assign(h,void 0);"function"==typeof d.CustomEvent?e=new d.CustomEvent(e,h):(d=d.document.createEvent("CustomEvent"),d.initCustomEvent(e,!!h.bubbles,!!h.cancelable,g),e=d);a.T.trigger(a.element,b,e,c)}function kb(a,b){var c={},d=G(a,"ampdoc").getAmpDoc(b);I(d,"mutator").measureMutateElement(b,(function(){c.alreadyTransparent="rgba(0, 0, 0, 0)"==(a.getComputedStyle(b)||La)["background-color"]}),(function(){c.alreadyTransparent||xa().warn("amp-lightbox","The background of the element has been forced to transparent. If you need to set background, use an intermediate container.");Na(b,{background:"transparent"})}))}"inabox"==ua().runtime&&kb(window,document.body);AMP.registerElement("amp-lightbox",Y,"amp-lightbox{display:none;position:fixed!important;z-index:1000;top:0!important;left:0!important;bottom:0!important;right:0!important}amp-lightbox[scrollable]{overflow-y:auto!important;overflow-x:hidden!important}i-amphtml-ad-close-header{height:60px!important;display:block!important;visibility:visible!important;opacity:0;position:fixed!important;top:0!important;left:0!important;right:0!important;z-index:1000!important;display:-ms-flexbox!important;display:flex!important;-ms-flex-align:center!important;align-items:center!important;-ms-flex-pack:right!important;justify-content:right!important;transition:opacity 0.1s ease-in}[animate-in=fly-in-bottom]>i-amphtml-ad-close-header,[animate-in=fly-in-top]>i-amphtml-ad-close-header{transition-delay:0.2s}.amp-ad-close-header{opacity:1!important;box-sizing:border-box;padding:5px;line-height:40px;background-color:#000;color:#fff;font-family:Helvetica,sans-serif;font-size:12px;cursor:pointer}.amp-ad-close-header>:first-child{margin-left:auto!important;pointer-events:none!important}.amp-ad-close-button{display:block!important;background:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff'%3E%3Cpath d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E\") no-repeat;background-position:50%;width:40px;height:40px;pointer-events:none!important;border-radius:40px;margin-left:5px}.amp-ad-close-header:active>.amp-ad-close-button{background-color:hsla(0,0%,100%,0.3)}\n/*# sourceURL=/extensions/amp-lightbox/0.1/amp-lightbox.css*/")}});//# sourceMappingURL=amp-lightbox-0.1.js.map